﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.Collections.Generic;

namespace MvcMusicStore.Models
{
    //[Bind(Exclude = "AlbumId")]
    public class Album
    {
        [ScaffoldColumn(false)]
        public int AlbumId { get; set; }

        [DisplayName("Genre")]
        public int GenreId { get; set; }

        [DisplayName("Artist")]
        public int ArtistId { get; set; }

        [DisplayName("Title")]
        [Required(ErrorMessage="{0} is required")]
        [StringLength(160)]
        public string Title { get; set; }

        [DisplayName("Price")]
        [Required(ErrorMessage = "{0} is required")]
        [Range(0.01, 100, ErrorMessage = "{0} must be between {1} and {2}")]
        //[RegularExpression("[0-9]+(\\.[0-9][0-9]?)?", ErrorMessage = "!!!")]
        [RegularExpression(@"\d+([.]\d{1,2})?", ErrorMessage = "{0} must be a number")]
        public decimal Price { get; set; }

        [DisplayName("Album art url")]
        //[DataType(DataType.u
        [StringLength(1024)]
        public string AlbumArtUrl { get; set; }

        public virtual Genre Genre { get; set; }
        public virtual Artist Artist { get; set; }
    }
}